package org.example.service.impl;

import com.github.pagehelper.PageHelper;
import org.example.dao.LogDao;
import org.example.domain.MyLog;
import org.example.domain.PageBean;
import org.example.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Jimmy
 * @version 1.0
 */
@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private LogDao logDao;

    @Override
    public PageBean<MyLog> findByPage(MyLog log,int pagenum, int pagesize) {
        PageHelper.startPage(pagenum, pagesize);
        List<MyLog> logs = logDao.findByPage(log);
        int total = logDao.findTotal(log);
        return new PageBean<>(total,pagenum,logs);
    }

    @Override
    public int addLog(MyLog log) {
        return logDao.addLog(log);
    }


}
